package com.jm.offer.easy;

import java.util.Arrays;

/**
 * @Description https://leetcode-cn.com/problems/bu-ke-pai-zhong-de-shun-zi-lcof/
 * @date 2022/5/3 9:07
 */
public class _61扑克牌中的顺子 {
    public static void main(String[] args) {
        System.out.println(isStraight(new int[]{
                0, 0, 1, 2, 5
        }));
    }

    public static boolean isStraight(int[] nums) {
        int joker = 0;
        Arrays.sort(nums);
        for(int i = 0; i < 4; i++) {
            if(nums[i] == 0) joker++;
            else if(nums[i] == nums[i + 1]) return false;
        }
        return nums[4] - nums[joker] < 5;
    }
}
